import axiosInstance from "@/api/axiosInstance";
import {objectToQueryParams} from "@/utils";

export const getSpaceRecommendListByRequest = function (data) {
    const datas = objectToQueryParams(data)
    return axiosInstance.get(`/social/space/recommend?${datas}`);
};

export const getSpaceSearchByRequest = function (data) {
    const datas = objectToQueryParams(data)
    return axiosInstance.get(`/social/space/search?${datas}`);
};

export const getSpaceDetailById = function (id) {
    return axiosInstance.get(`/social/space/info?spaceId=${id}`);
};

export const getSpaceJoinQrByIdRequest = function (id) {
    return axiosInstance.get(`/social/space/qrCodeList?spaceId=${id}`);
};


export const getSpaceVideoListByIdRequest = function (id) {
    return axiosInstance.get(`/social/space/videoList?spaceId=${id}`);
};

export const getSpaceFacilityListByRequest = function (id) {
    return axiosInstance.get(`/social/space/facilityList?spaceId=${id}`);
};

export const getSpaceActivityListByRequest = function (id) {
    const data = {
        spaceId: id,
        current: 1,
        size: 1000
    };
    const datas = objectToQueryParams(data)
    return axiosInstance.get(`/social/space/activityList?${datas}`);
};

export const getSpaceMapListByRequest = function (params) {
    const data = {
        current: 1,
        size: 1000,
        ...params,
    };
    const datas = objectToQueryParams(data)
    return axiosInstance.get(`/social/space/getSpaceMap?${datas}`);
};

export const getSpacePreductionByRequest = function (id) {
    const data = {
        spaceId: id,
    };
    const datas = objectToQueryParams(data)
    return axiosInstance.get(`/social/space/introduce?${datas}`);
};
